local zhuozhuo = fk.CreateSkill{
  name = "steam__zhuozhuo",
}

zhuozhuo:addEffect(fk.CardUseFinished, {
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(self.name) and target == player and player:usedSkillTimes(zhuozhuo.name, Player.HistoryTurn)==0
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    
    -- 检查是否有非基本手牌
    local non_basic_cards = {}
    for _, card_id in ipairs(player:getCardIds("h")) do
      local card = Fk:getCardById(card_id)
      if card.type~=Card.TypeBasic then
        table.insert(non_basic_cards, card_id)
      end
    end
    
    -- 弃置所有非基本手牌
    if #non_basic_cards > 0 then
      room:throwCard(non_basic_cards, self.name,player, player)
    end
    
    -- 计算摸牌数（与你手牌数相同的角色数）
    local hand_count = #player:getCardIds("h")
    local alive_count = 0
    for _, p in ipairs(room:getAlivePlayers()) do
      if p:getHandcardNum()==hand_count then
        alive_count = alive_count + 1
      end
    end
  
      player:drawCards(alive_count, self.name)
    
    
   
  end,
})



Fk:loadTranslationTable{
  ["steam__zhuozhuo"] = "卓卓",
  [":steam__zhuozhuo"] = "每回合限一次，你使用牌后，可以弃置所有非基本手牌，然后摸与你手牌数相同的角色数张牌。",
  ["@steam__zhuozhuo_used"] = "卓卓已用",
}

return zhuozhuo 